package palindrome

import "github.com/molio/practice/ds/stack"

// 回文结构的字符串、数字判断

func IsPalindromeWord(word string) bool {
	wLen := len(word)
	ss1 := stack.NewSequenceStack(wLen)
	for i := wLen - 1; i >= 0; i-- {
		ss1.PushStack(word[i])
	}
	ss2 := stack.NewSequenceStack(wLen)
	for i := 0; i < wLen; i++ {
		ss2.PushStack(word[i])
	}
	for i := 0; i < wLen; i++ {
		if ss1.PopStack() != ss2.PopStack() {
			return false
		}
	}
	return true
}
